<!DOCTYPE html>
<title>Feature-Policy Fullscreen</title>
<div>Fullscreen</div>
<script>
document.onwebkitfullscreenerror = function() {
  parent.postMessage({ type: 'error', enabled: document.webkitFullscreenEnabled }, '*');
};

document.onwebkitfullscreenchange = function() {
  if (document.webkitFullscreenElement) {
    document.webkitExitFullscreen();
    parent.postMessage({ type: 'change', enabled: document.webkitFullscreenEnabled }, '*');
  }
};

document.addEventListener('keypress', function() {
  document.querySelector('div').webkitRequestFullscreen();
});

window.onload = function() {
  focus();
  eventSender.keyDown('a', []);
}
</script>
